/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clienttest;

import clienttest.common.ConnectManager;
import clienttest.object.CreditCard;
import clienttest.object.ResultReponse;
import java.awt.Checkbox;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author lekhanhduy
 */
public class ManageCommon extends javax.swing.JPanel {

    private CreditCard creditCard;
    private ConnectManager connectManager;
    private StaffBankForm staffBankForm;

    /**
     * Creates new form CreditCard
     */
    public ManageCommon() {
        initComponents();
        connectManager = new ConnectManager();
        jCbMoney.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"500000", "1000000", "1500000", "2000000"}));
        jCbMoney2.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"500000", "1000000", "1500000", "2000000"}));
        setDataTable();
    }

    public void DisplayInfo(CreditCard credit, StaffBankForm staffBankForm) {
        creditCard = credit;
        if (creditCard != null) {
            jLblInfo.setText("<html>" + creditCard.toStringStaff().replace("\n", "<br>") + "</html>");
            this.staffBankForm = staffBankForm;
        }

    }

    public void setDataTable() {
        Object[][] data = connectManager.getAllUserCreditCard();
        jTblAccount.setModel(new javax.swing.table.DefaultTableModel(
                data,
                new String[]{
                    "Số tài khoản", "Họ và tên", "Ngày sinh", "Số dư", "Điện thoại", "Email", "Địa chỉ thường trú", "Chọn"
                }) {

            @Override
            public Class<?> getColumnClass(int columnIndex) {
                if (getColumnName(columnIndex).equals("Chọn")) {
                    return Boolean.class;
                }
                return super.getColumnClass(columnIndex);
            }
        });


        validate();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPnInfo = new javax.swing.JPanel();
        jlblInfoStaff = new javax.swing.JLabel();
        jLblInfo = new javax.swing.JLabel();
        jPnAction = new javax.swing.JPanel();
        jLblAction = new javax.swing.JLabel();
        jTxfAcountRev = new javax.swing.JTextField();
        jBtnSent = new javax.swing.JButton();
        jCbMoney = new javax.swing.JComboBox();
        jCbMoney2 = new javax.swing.JComboBox();
        jBtnTransfer = new javax.swing.JButton();
        jTxFAccountSent = new javax.swing.JTextField();
        jTxfAccountReiv = new javax.swing.JTextField();
        jPnHistory = new javax.swing.JPanel();
        jBtnHistory = new javax.swing.JButton();
        jDateFromDate = new com.toedter.calendar.JDateChooser();
        jlblFromDate = new javax.swing.JLabel();
        jLblToDate = new javax.swing.JLabel();
        jDateToDate = new com.toedter.calendar.JDateChooser();
        jLblListAccount = new javax.swing.JLabel();
        jScrollPaneAccount = new javax.swing.JScrollPane();
        jTblAccount = new javax.swing.JTable();

        setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 2, true));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPnInfo.setBackground(new java.awt.Color(204, 204, 204));
        jPnInfo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102), 2));

        jlblInfoStaff.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jlblInfoStaff.setText("Thông tin nhân viên");

        jLblInfo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLblInfo.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLblInfo.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        javax.swing.GroupLayout jPnInfoLayout = new javax.swing.GroupLayout(jPnInfo);
        jPnInfo.setLayout(jPnInfoLayout);
        jPnInfoLayout.setHorizontalGroup(
            jPnInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnInfoLayout.createSequentialGroup()
                .addGroup(jPnInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnInfoLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLblInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPnInfoLayout.createSequentialGroup()
                        .addGap(69, 69, 69)
                        .addComponent(jlblInfoStaff)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPnInfoLayout.setVerticalGroup(
            jPnInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnInfoLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jlblInfoStaff, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLblInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        add(jPnInfo, new org.netbeans.lib.awtextra.AbsoluteConstraints(2, 2, -1, -1));

        jPnAction.setBackground(new java.awt.Color(204, 204, 204));
        jPnAction.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102), 2));

        jLblAction.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLblAction.setText("Quản lý gửi/chuyển tiền");

        jTxfAcountRev.setToolTipText("Nhập tài khoản muốn gửi tiền!");

        jBtnSent.setText("Gửi tiền");
        jBtnSent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnSentActionPerformed(evt);
            }
        });

        jCbMoney.setEditable(true);
        jCbMoney.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jCbMoney.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCbMoneyActionPerformed(evt);
            }
        });

        jCbMoney2.setEditable(true);
        jCbMoney2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jCbMoney2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCbMoney2ActionPerformed(evt);
            }
        });

        jBtnTransfer.setText("Chuyển tiền");
        jBtnTransfer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnTransferActionPerformed(evt);
            }
        });

        jTxFAccountSent.setToolTipText("Tài khoản chuyển");

        jTxfAccountReiv.setToolTipText("Tài khoản nhận");

        javax.swing.GroupLayout jPnActionLayout = new javax.swing.GroupLayout(jPnAction);
        jPnAction.setLayout(jPnActionLayout);
        jPnActionLayout.setHorizontalGroup(
            jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnActionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnActionLayout.createSequentialGroup()
                        .addGap(0, 264, Short.MAX_VALUE)
                        .addComponent(jLblAction)
                        .addGap(143, 143, 143))
                    .addGroup(jPnActionLayout.createSequentialGroup()
                        .addGroup(jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTxfAcountRev, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jTxFAccountSent)
                            .addComponent(jTxfAccountReiv))
                        .addGap(18, 18, 18)
                        .addGroup(jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPnActionLayout.createSequentialGroup()
                                .addComponent(jCbMoney2, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jBtnTransfer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(jPnActionLayout.createSequentialGroup()
                                .addComponent(jCbMoney, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jBtnSent, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())))
        );
        jPnActionLayout.setVerticalGroup(
            jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnActionLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLblAction, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTxfAcountRev)
                    .addComponent(jCbMoney)
                    .addComponent(jBtnSent, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnActionLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTxFAccountSent, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTxfAccountReiv, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPnActionLayout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addGroup(jPnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jCbMoney2)
                            .addComponent(jBtnTransfer, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(28, 28, 28))
        );

        add(jPnAction, new org.netbeans.lib.awtextra.AbsoluteConstraints(283, 2, 570, -1));

        jPnHistory.setBackground(new java.awt.Color(204, 204, 204));
        jPnHistory.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102), 2));
        jPnHistory.setForeground(new java.awt.Color(102, 102, 102));

        jBtnHistory.setText("Lịch sử giao dịch");
        jBtnHistory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnHistoryActionPerformed(evt);
            }
        });

        jlblFromDate.setText("Từ ngày :");

        jLblToDate.setText("Đến ngày :");

        jLblListAccount.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLblListAccount.setText("Danh sách tài khoản ");

        jScrollPaneAccount.setBorder(null);

        jTblAccount.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4", "Title 5"
            }
        ));
        jScrollPaneAccount.setViewportView(jTblAccount);

        javax.swing.GroupLayout jPnHistoryLayout = new javax.swing.GroupLayout(jPnHistory);
        jPnHistory.setLayout(jPnHistoryLayout);
        jPnHistoryLayout.setHorizontalGroup(
            jPnHistoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnHistoryLayout.createSequentialGroup()
                .addComponent(jLblListAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 146, Short.MAX_VALUE)
                .addComponent(jBtnHistory, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jlblFromDate)
                .addGap(2, 2, 2)
                .addComponent(jDateFromDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLblToDate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jDateToDate, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(jScrollPaneAccount)
        );
        jPnHistoryLayout.setVerticalGroup(
            jPnHistoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnHistoryLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPnHistoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnHistoryLayout.createSequentialGroup()
                        .addGroup(jPnHistoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLblToDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jDateToDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jlblFromDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jDateFromDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jBtnHistory, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addGap(9, 9, 9))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnHistoryLayout.createSequentialGroup()
                        .addComponent(jLblListAccount)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addComponent(jScrollPaneAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        add(jPnHistory, new org.netbeans.lib.awtextra.AbsoluteConstraints(2, 197, 850, -1));
    }// </editor-fold>//GEN-END:initComponents

    private void jCbMoneyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCbMoneyActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCbMoneyActionPerformed

    private void jCbMoney2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCbMoney2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCbMoney2ActionPerformed

    private void jBtnSentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSentActionPerformed
        // TODO add your handling code here:
        String user_rev = jTxfAcountRev.getText().toString();
        if (user_rev.equals("")) {
            JOptionPane.showMessageDialog(this,
                    "Tài khoản nhận không được trống!",
                    "Lỗi tài khoản nhận!",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }
        ResultReponse resulTemp = connectManager.check_transfers(user_rev);
        if (resulTemp != null) {
            if (resulTemp.isSuccess()) {
                if (CheckInputMoney(jCbMoney)) {
                    double input = Double.valueOf(jCbMoney.getSelectedItem().toString());
                    ResultReponse result = connectManager.sentWithDrawMoney(user_rev, "sent", input);
                    if (result != null) {
                        if (result.isSuccess()) {
                            JOptionPane.showMessageDialog(this,
                                    result.getNote(),
                                    "Gửi tiền thành công!",
                                    JOptionPane.INFORMATION_MESSAGE);
                            setDataTable();
                        } else {
                            JOptionPane.showMessageDialog(this,
                                    result.getNote(),
                                    "Gửi tiền lỗi!",
                                    JOptionPane.ERROR_MESSAGE);
                        }
                    }
                }
            } else {
                JOptionPane.showMessageDialog(this,
                        resulTemp.getNote(),
                        "Lỗi sai tài khoản nhận!",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_jBtnSentActionPerformed

    private void jBtnTransferActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnTransferActionPerformed
        // TODO add your handling code here:
        String user_sent = jTxFAccountSent.getText().toString();
        String user_rev = jTxfAccountReiv.getText().toString();

        if (user_sent.equals("") || user_rev.equals("")) {
            JOptionPane.showMessageDialog(this,
                    "Tài khoản nhận không được trống!",
                    "Lỗi tài khoản nhận!",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (user_rev.equals(user_sent)) {
            JOptionPane.showMessageDialog(this,
                    "Hai tài khoản giống nhau!",
                    "Lỗi tài khoản!",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (!checkAccount(user_sent)) {
            JOptionPane.showMessageDialog(this,
                    "Không tồn tại tài khoản gửi!",
                    "Lỗi tài khoản gửi!",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }

        if (!checkAccount(user_rev)) {
            JOptionPane.showMessageDialog(this,
                    "Không tồn tại tài khoản nhận!",
                    "Lỗi tài khoản nhận!",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }

        if (CheckInputMoney(jCbMoney2)) {
            double input = Double.valueOf(jCbMoney2.getSelectedItem().toString());
            ResultReponse resultTemp2 = connectManager.transfersCreditCard(user_sent, user_rev, input);
            if (resultTemp2 != null) {
                if (resultTemp2.isSuccess()) {
                    JOptionPane.showMessageDialog(this,
                            resultTemp2.getNote(),
                            "Chuyển tiền thành công!",
                            JOptionPane.INFORMATION_MESSAGE);
                    setDataTable();
                } else {
                    JOptionPane.showMessageDialog(this,
                            resultTemp2.getNote(),
                            "Lỗi chuyển tiền!",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        } else {
        }
    }//GEN-LAST:event_jBtnTransferActionPerformed

    private void jBtnHistoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnHistoryActionPerformed
        // TODO add your handling code here:
        int countRow = jTblAccount.getRowCount();
        int countColumn = jTblAccount.getColumnCount();
        SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd");
        String dateFrom = dt.format(jDateFromDate.getDate());
        String dateTo = dt.format(jDateToDate.getDate());
        List<Object[]> list = new ArrayList<Object[]>();
        if (countColumn > 0 && countRow > 0) {
            for (int i = 0; i < countRow; i++) {
                CreditCard credit = getCreditCardCheck(i);
                if (credit != null) {
                    Object[][] data = connectManager.getAllHistoryCreditCard(credit.getAccountCode().trim(), dateFrom, dateTo);
                    for (int j = 0; j < data.length; j++) {
                        Object[] objects = data[j];
                        Object[] temp = new Object[6];
                        temp[0] = credit.getAccountCode();
                        temp[1] = objects[0].toString();
                        temp[2] = objects[1].toString();
                        temp[3] = objects[2].toString();
                        temp[4] = objects[3].toString();
                        temp[5] = objects[4].toString();
                        list.add(temp);
                    }
                    Object[] line = {"","","","","",""};
                    list.add(line);
                }
            }
        }
        staffBankForm.displayHistory(list);
    }//GEN-LAST:event_jBtnHistoryActionPerformed

    private CreditCard getCreditCardCheck(int row) {
        CreditCard credit = null;
        boolean check = Boolean.parseBoolean(jTblAccount.getModel().getValueAt(row, 7).toString());
        if (check) {
            credit = new CreditCard();
            credit.setAccountCode(jTblAccount.getModel().getValueAt(row, 0).toString());
        }
        return credit;
    }

    private boolean checkAccount(String account) {
        ResultReponse resulTemp = connectManager.check_transfers(account);
        if (resulTemp != null && resulTemp.isSuccess()) {
            return true;
        } else {
            return false;
        }
    }

    public boolean CheckInputMoney(JComboBox jcombobox) {
        boolean result = false;
        if (creditCard != null) {
            double input = 0;
            try {
                input = Double.valueOf(jcombobox.getSelectedItem().toString());
                if (!creditCard.checkMonney(input)) {
                    JOptionPane.showMessageDialog(this,
                            "Số tiền phải lớn hơn 0 và là bội số của 10000 VND!",
                            "Lỗi đầu vào!",
                            JOptionPane.ERROR_MESSAGE);
                    jcombobox.setSelectedIndex(0);
                } else {
                    result = true;
                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,
                        "Số tiền phải lớn hơn 0 và là bội số của 10000 VND!",
                        "Lỗi đầu vào!",
                        JOptionPane.ERROR_MESSAGE);
                jcombobox.setSelectedIndex(0);
            }
        }
        return result;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnHistory;
    private javax.swing.JButton jBtnSent;
    private javax.swing.JButton jBtnTransfer;
    private javax.swing.JComboBox jCbMoney;
    private javax.swing.JComboBox jCbMoney2;
    public com.toedter.calendar.JDateChooser jDateFromDate;
    public com.toedter.calendar.JDateChooser jDateToDate;
    private javax.swing.JLabel jLblAction;
    private javax.swing.JLabel jLblInfo;
    private javax.swing.JLabel jLblListAccount;
    private javax.swing.JLabel jLblToDate;
    private javax.swing.JPanel jPnAction;
    private javax.swing.JPanel jPnHistory;
    private javax.swing.JPanel jPnInfo;
    private javax.swing.JScrollPane jScrollPaneAccount;
    private javax.swing.JTable jTblAccount;
    private javax.swing.JTextField jTxFAccountSent;
    private javax.swing.JTextField jTxfAccountReiv;
    private javax.swing.JTextField jTxfAcountRev;
    private javax.swing.JLabel jlblFromDate;
    private javax.swing.JLabel jlblInfoStaff;
    // End of variables declaration//GEN-END:variables
}
